/**
 * 1
 *  
 * @Author : roryrywang
 * @DateTime : 24-9-10 下午6:39
 */

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    vector<pair<int, int>> vec;
    string line;
    getline(cin, line);
    while (line != "") {
        int idx = 0;
        while (line[idx] != ',')idx++;
        int a = stoi(line.substr(0, idx));
        int b = stoi(line.substr(idx + 1, line.size() - idx));
        vec.push_back({a, b + 10});
        getline(cin, line);
    }
    sort(vec.begin(), vec.end());
    vector<pair<int, int>> res;
    for (auto v: vec) {
        int tmp = -1;
        int idx = 0;
        for (int i = 0; i < res.size(); i++) {
            if (v.first >= res[i].second) {
                if (tmp < res[i].second) {
                    tmp = res[i].second;
                    idx = i;
                }
            }
        }
        if (tmp == -1) {
            res.push_back({v.first, v.second});
        } else {
            res[idx].second = v.second;
        }
    }
    cout << res.size();
    return 0;
}